#ifndef RBNODE_H_
#define RBNODE_H_

#include <string>

class RBNode
{
public:
	RBNode(unsigned int);
	virtual ~RBNode();
	void insertNode(RBNode *);
//	void deleteNode(RBNode *);
	RBNode * find(unsigned long long);
	void showTree();
	unsigned int setTreeString(std::string &);
	void setParent (RBNode * p) { parent = p; }
	RBNode * getParent() { return parent; }
	
	
private:

	void insertFixup(RBNode * z);
	void privateShowTree(RBNode *);
	void privateSetTreeString(RBNode *, std::string &, unsigned int &);
	void setLeft (RBNode * l) { left = l; }
	void setRight (RBNode * r) { right = r; }
	void setBlack (bool b) { black = b; }
	void incOccurrences() { numOccurrences++; }
	
	unsigned int getNumOcurrences() { return numOccurrences; } 
	RBNode * getRight() { return right; }
	RBNode * getLeft() { return left; }
	bool isBlack() { return black; }
	unsigned long long getId() { return id; }
	
	void leftRotate(RBNode *);
	void rightRotate(RBNode *);
	
	bool black;
	unsigned long long id;
	unsigned short numOccurrences;
	RBNode * left;
	RBNode * right;
	RBNode * parent;
	static RBNode * nullNode;
};

#endif /*RBNODE_H_*/
